package com.vhall.component.plugin.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author shimingming
 * @since 2023/5/29 14:07
 */
@Getter
@AllArgsConstructor
public enum RoomConfigStatusEnum {


    // 0 关，1开 {@link com.vhall.component.entity.subject.enums.StatusEnum}

    SCROLLING_STATUS("scrolling_status", 0, "跑马灯"),
    CUSTOM_TAG_STATUS("custom_tag_status", 0, "自定义"),
    FILTER_WORDS_STATUS("filter_words_status", 1, "敏感词"),
    PENDANT_STATUS("pendant_status", 0, "挂件"),
    QUESTION_STATUS("question_status", 0, "问卷"),
    EXAM_STATUS("exam_status", 0, "考试"),
    RESERVATION_STATUS("reservation_status", 1, "预约标记"),
    COMMENT_STATUS("comment_status", 1, "评论标记"),

    CHAT_MANAGEMENT_LIVE("chat_management_live", 1, "聊天管理-直播中"),
    CHAT_MANAGEMENT_PLAYBACK("chat_management_playback", 0, "聊天管理-回放"),
    CHAT_MANAGEMENT_GIFT("chat_management_gift", 1, "聊天管理-表情"),
//    0:需要设置回放,1,无需设置回放,默认为需要设置回放
    NO_NEED_SET_PLAYBACK("no_need_set_playback", 0, "标记无须回放")

    ;
    private final String value;

    /**
     * 默认值
     */
    private final Integer defauleValue;

    private final String description;


    public static Integer getDefauleValue(String value) {
        RoomConfigStatusEnum parse = parse(value);
        if (parse != null) {
            return parse.getDefauleValue();
        }
        return 0;
    }

    public static String getDescription(String value) {
        RoomConfigStatusEnum parse = parse(value);
        if (parse != null) {
            return parse.getDescription();
        }
        return StringUtils.EMPTY;
    }

    public static RoomConfigStatusEnum parse(String value) {
        for (RoomConfigStatusEnum anEnum : RoomConfigStatusEnum.values()) {
            if (anEnum.getValue().equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}
